<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>控制器</title>
    <script src="https://cdn.staticfile.org/angular.js/1.4.6/angular.min.js"></script>
    <script>
        var app = angular.module('myApp', []); //定义了一个叫myApp的模块
        //定义控制器
        app.controller('myController', function ($scope) {
            $scope.add = function () {
                return parseInt($scope.x) + parseInt($scope.y);
            }
        });
    </script>
</head>
<body ng-app="myApp" ng-controller="myController">
x:<input ng-model="x">
y:<input ng-model="y">
运算结果：{{add()}}
</body>
</html>
